#include "threadpool.hpp"
#include "task.hpp"

//void test1()
//{
//	Local_Thread_Pool::LocalThreadPool<task_t> lothr(1);
//	for (int i = 0; i < 10; i++)
//	{
//		lothr.TaskPush(Download);
//	}
//	//析构自动调用Join
//	std::cout << "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" << std::endl;
//	//lothr.Join();
//}

void test2()
{
	for (int i = 0; i < 10; i++)
	{
		Local_Thread_Pool::LocalThreadPool<task_t>::GetInstance()->TaskPush(Download);
	}
	Local_Thread_Pool::LocalThreadPool<task_t>::GetInstance()->~LocalThreadPool();
}
int main()
{
	test2();
	return 0;
}

//// constructing threads
//#include <iostream>       // std::cout
//#include <atomic>         // std::atomic
//#include <thread>         // std::thread
//#include <vector>         // std::vector
//#include <windows.h>
//void increase_global() { for (int i = 0; i < 10; ++i) { Sleep(1000);std::cout << i << std::endl; } }// ++global_counter; }
//int main()
//{
//    std::vector<std::thread*> threads;
//    std::cout << "increase global counter with 10 threads...\n";
//    for (int i = 1; i <= 10; ++i)
//    {
//        std::thread* th1= new std::thread(increase_global);
//        threads.push_back(th1);
//    }
//    for (int i = 1; i <= 10; ++i)
//        (*threads[i]).join();
//    return 0;
//}